Source for file SC_DbConn.php
Documentation is available at SC_DbConn.php
* This file is part of EC-CUBE
* Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
require_once($current_dir .
"/../module/DB.php");
function SC_DbConn($dsn =
"", $err_disp =
true, $new =
false){
$options['debug'] =
PEAR_DB_DEBUG;
$options['persistent'] =
PEAR_DB_PERSISTENT;
// 既に接続されていないか、新規接続要望の場合は接続する。
if(!isset
($objDbConn->connection) ||
$new) {
$objDbConn =
DB::connect($dsn, $options);
$objDbConn =
DB::connect(DEFAULT_DSN, $options);
$this->dsn =
DEFAULT_DSN;
if (DB_TYPE ==
'mysql') {
$objDbConn->query('SET NAMES utf8');
$this->conn =
$objDbConn;
function query($n ,$arr =
"", $ignore_err =
false){
if (DB_TYPE ==
"mysql") $n =
$this->dbFactory->sfChangeMySQL($n);
$result =
$this->conn->query($n, $arr);
$result =
$this->conn->query($n);
if ($this->conn->isError($result) &&
!$ignore_err){
function getOne($n, $arr =
""){
if (DB_TYPE ==
"mysql") $n =
$this->dbFactory->sfChangeMySQL($n);
$result =
$this->conn->getOne($n, $arr);
$result =
$this->conn->getOne($n);
if ($this->conn->isError($result)){
function getRow($n, $arr =
""){
if (DB_TYPE ==
"mysql") $n =
$this->dbFactory->sfChangeMySQL($n);
$result =
$this->conn->getRow($n, $arr);
$result =
$this->conn->getRow($n);
if ($this->conn->isError($result)){
function getCol($n, $col, $arr =
"") {
if (DB_TYPE ==
"mysql") $n =
$this->dbFactory->sfChangeMySQL($n);
$result =
$this->conn->getCol($n, $col, $arr);
$result =
$this->conn->getCol($n, $col);
if ($this->conn->isError($result)) {
function getAll($n, $arr =
""){
if (DB_TYPE ==
"mysql") $n =
$this->dbFactory->sfChangeMySQL($n);
if(PEAR::isError($this->conn)) {
$result =
$this->conn->getAll($n, $arr, DB_FETCHMODE_ASSOC);
$result =
$this->conn->getAll($n, DB_FETCHMODE_ASSOC);
if ($this->conn->isError($result)){
function autoExecute($table_name, $fields_values, $sql_where =
null){
$result =
$this->conn->autoExecute( $table_name, $fields_values, DB_AUTOQUERY_UPDATE, $sql_where);
$result =
$this->conn->autoExecute( $table_name, $fields_values, DB_AUTOQUERY_INSERT);
if ($this->conn->isError($result)){
$result =
$this->conn->prepare($n);
$result =
$this->conn->execute($n, $obj);
$this->conn->disconnect();
$url .=
$_SERVER['HTTP_HOST'] .
$_SERVER['REQUEST_URI'];
$errmsg.=
"SERVER_ADDR:" .
$_SERVER['SERVER_ADDR'] .
"\n";
$errmsg.=
"REMOTE_ADDR:" .
$_SERVER['REMOTE_ADDR'] .
"\n";
$errmsg.=
"USER_AGENT:" .
$_SERVER['HTTP_USER_AGENT'] .
"\n\n";
$errmsg.=
$result->message .
"\n\n";
$errmsg.=
$result->userinfo .
"\n\n";
foreach($arrRbacktrace as $backtrace) {
if($backtrace['class'] !=
"") {
$func =
$backtrace['class'] .
"->" .
$backtrace['function'];
$func =
$backtrace['function'];
$errmsg.=
$backtrace['file'] .
" " .
$backtrace['line'] .
":" .
$func .
"\n";
require_once(CLASS_EX_PATH .
"page_extends/error/LC_Page_Error_SystemError_Ex.php");
if (DEBUG_MODE ==
true) {
* @param boolean $disp trueの場合、画面出力を行う.
$sql =
$this->conn->last_query;
Documentation generated on Tue, 28 Apr 2009 18:13:14 +0900 by phpDocumentor 1.4.2